﻿using MyNeighbourhood.Managers;
using MyNeighbourhood.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace MyNeighbourhood.Controllers
{
    public class BaseController : Controller
    {
        EventsManager eventsManager = new EventsManager();

        protected List<EventModel> GetAllEventsModel()
        {
            var eventsDb = eventsManager.GetAllEvents();
            var model = new List<EventModel>();

            foreach (var eventDb in eventsDb)
            {
                model.Add(new EventModel
                {
                    EventId = eventDb.EventId,
                    Name = eventDb.Name,
                });
            }

            return model;
        }
    }
}
